/*
 * #depends subsonic-login.js
 */
/**
 * We can override the below since we know that responseData will contain the parsed json (and have the 'subsonic-response' tag
 * removed which seems to cause Ext some problems (TODO: report as a bug to sencha)
 */
Ext.data.JsonReader.prototype.read = function(response) {
    var json = response.responseData;
	if (Ext.isDefined(this.preProcessResponse)) {
		this.preProcessResponse(json);
	}
    return this.readRecords(json);
};


/**
 * Defines a JSON based store for the Folder view on desktop.
 * Note this has to be a separate store form the track grid one because we only show current directory contents
 * and don't recurse into the sub directories.
 */
Ext.ux.mattgoldspink.subsonic.FolderViewStore = new Ext.data.JsonStore({
    url: Ext.ux.mattgoldspink.subsonic.apiUrl + '/rest/getMusicDirectory.view',
    root: 'directory.child',
    baseParams: Ext.ux.mattgoldspink.subsonic.LoginDetails,
    restful: true,
    idProperty: 'id',
    fields: Ext.ux.mattgoldspink.subsonic.Fields
});
